<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    function draw() {
      var canvas = document.getElementById('canvas')
      if (canvas.getContext) {
        var ctx = canvas.getContext('2d')
        // 新建一条路径
        ctx.beginPath()
        // 指定起始位置
        ctx.moveTo(75, 50)
        // 连线
        ctx.lineTo(75, 90)
        ctx.lineTo(55, 70)
        // 填充内容区域，没有形成闭合路径就会连接当前位置到起始位置
        ctx.fill()
      }
    }
  </script>
</head>
<body onload="draw()">
  <canvas id="canvas" width="150" height="150"></canvas>
</body>
</html>